<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div class="list-content">
        <div
          @click="viewImg(item.moduleId, item.id)"
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
          :class="{
            'exhibits-item-0': index === 0,
            'exhibits-item-two': (index + 1) % 2 === 0,
          }"
          :style="{
            backgroundImage: `url(${
              (index + 1) % 2 === 0
                ? publicUrls + 'free/style12/exhibitiondisplayBoardtyle2bg2.webp'
                : publicUrls + 'free/style12/exhibitiondisplayBoardtyle2bg1.webp'
            })`, 
          }"
        >
          <div class="item-content">
            <div class="items-title">
              <div class="title-content">
                {{ item.name }}
              </div>
            </div>
            <div class="cover-box">
              <img class="cover" v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
              <!-- <FlowerCom /> -->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import FlowerCom from './flower.vue';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
  -webkit-box-reflect: below 24% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list {
  display: flex;
  padding: 0 20px;
  width: 100%;
  height: 100%;
}
.list-content {
  display: flex;
  height: 100%;
}
//460

.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}

.exhibits-item {
  display: flex;
  flex-direction: column;

  justify-content: center;
  position: relative;
  width: 385px;
  height: 420px;
  margin-left: 40px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 70px 87px 70px 18px;
}
.exhibits-item-two {
  padding: 70px 8px 70px 95px;
}
.exhibits-item-0 {
  margin-left: 0px;
}
.item-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 280px;
  height: 280px;
  border-radius: 50%;
}
.cover-box {
  position: relative;
  width: 280px;
  height: 280px;
  overflow: hidden;
  border-radius: 50%;
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s;
}
.exhibits-item:hover {
  .items-title {  
    opacity: 1;
  } 
  .cover {
    transform: scale(1.2);
  }
}
.items-title {  
  position: absolute;
  top: 0px;
  left: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  height: 280px;
  z-index: 3;
  opacity: 0;
  border-radius: 50%;
  background: rgba(100, 0, 0, 0.5);
}
.title-content {
  width: 221px;
  max-height: 30px;
  font-family: PingFang SC;
  font-size: 16px;
  font-weight: 400;
  line-height: 30px;
  text-align: center;
  color: rgba(254, 214, 129, 1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
